<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>更新用户</title>
<script type="text/javascript">
	function method01() {
		//提交前先让<span>显示内容初始值
		 var spannameElement = document.getElementById('usernameerror');
		 spannameElement.innerHTML='<font color="red">* 用户名在4~11位</font>';
		 var spanpasswordElement = document.getElementById('userpassworderror');
		 spanpasswordElement.innerHTML='<font color="red">* 密码在6~14位</font>'
		
		 var usernameElement = document.getElementsByName('user_name');
		 var uesrnamecontent = usernameElement[0].value;
		 if(!(uesrnamecontent!=null&&uesrnamecontent.length>=4&&uesrnamecontent.length<=11)){
			 spannameElement.innerHTML='<font color="red">用户名错误！</font>'
			 return false;
		 }
		 var userpasswordElement = document.getElementsByName('user_password');
		 var userpasswordcontent = userpasswordElement[0].value;
		 if(!(userpasswordcontent!=null&&userpasswordcontent.length>=6&&userpasswordcontent.length<=14)){
		      spanpasswordElement.innerHTML='<font color="red">密码错误！</font>'
		      return false;
		 }
		    return true;
	}
</script>
</head>
<body>
<form action="${pageContext.request.contextPath }/servlet/updateuserservlet" method='post' onsubmit="return method01()">
	id:<input type="text" name="user_id" readonly="readonly" value="${updateuser.userId }"><br>
	用户名：<input type='text' name='user_name' value=${updateuser.userName }><span id="usernameerror"><font color="red">*用户名在4~11位</font></span><br>
	密码：<input type="password" value="${updateuser.userPassword }"><span id="userpassworderror"><font color="red">*密码在6~14位</font></span><br>
	<select name="select_dept">
		<option value="${updateuser.dept.deptName }"></option>
		<c:forEach var="dept" items="${deptInfo }">
			<%--<c:if test="${dept.deptName!=updateuser.dept.deptName}">--%>
					<option value=${dept.deptName}>${dept.deptName}</option>
				<%--</c:if>--%>
		</c:forEach>
	</select>
	描述：<input type='text' name='user_desc' value=${updateuser.userDesc }><br>
	状态：<input type='radio' name='user_flag' value='1'  ${updateuser.userStatus==1?"checked='checked'":"  " }> 启用
			<input type='radio' name='user_flag' value='0'  ${updateuser.userStatus==0?"checked='checked'":"  " }> 禁用<br>
		
		<input type='submit' value='更新'><input type='reset' value='清空'>
</form>
</body>
</html>